package com.isoft.demo.dao;


import com.isoft.demo.entity.Employee;
import com.isoft.demo.entity.Vehicle;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface VehicleDao {
    //新增
    @Insert("insert into vehicle(vnumber,vtype,vstatus,eid) values (#{vnumber},#{vtype},#{vstatus},#{eid})")
    int addVehicle(Vehicle vehicle);
    //修改
    @Update("update vehicle set vtype=#{vtype},eid=#{eid},vstatus=#{vstatus} where vid=#{vid}")
    int updateVehicle(Vehicle vehicle);
    //删除
    @Delete("delete from vehicle where vid=#{vid}")
    int deleteVehicle(int vid);
    //查询
    @Select("select * from vehicle")
    List<Vehicle> findAllVehicle();
    //根据id查询
    @Select("select vid from vehicle")
    List<Vehicle> findByVid(Integer vid);

    @Select("select * from vehicle where vstatus='空闲'")
    List<Vehicle>findIdle();

}
